package com.robot.admin.client;

import com.robot.admin.client.impl.AdClientImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


/**
 * @author wuyunbin
 */
@Component
@FeignClient(value = "robot-ad", fallback = AdClientImpl.class)
public interface AdClient {
    /**
     * 广告列表-条件查询
     *
     * @param searchMap 查询条件封装
     * @param page      页码
     * @param size      页大小
     * @return 分页结果
     */
    @RequestMapping(value = "ad/third/findAdBySearch/{page}/{size}", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public String thirdFindAdBySearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size);

    /**
     * 根据ID查询广告详情
     *
     * @param id ID
     * @return
     */
    @RequestMapping(value = "ad/third/findAdById/{id}", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
    public String thirdFindAdById(@PathVariable String id);

    /**
     * 增加广告
     *
     * @param ad
     */
    @RequestMapping(value = "ad/third/addAdByAd", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public void thirdAddAdByAd(@RequestBody String ad);

    /**
     * 修改广告
     *
     * @param ad
     */
    @RequestMapping(value = "ad/third/updateAdByAd", method = RequestMethod.PUT, produces = "application/json;charset=utf-8")
    public void thirdUpdateAdByAd(@RequestBody String ad);

    /**
     * 删除广告
     *
     * @param id
     */
    @RequestMapping(value = "ad/third/deleteAdById/{id}", method = RequestMethod.DELETE, produces = "application/json;charset=utf-8")
    public void thirdDeleteAdById(@PathVariable String id);

    /**
     * 根据状态查找广告列表
     *
     * @param status
     * @return
     */
    @GetMapping(value = "ad/third/findAdsByStatusToIndex/{status}", produces = "application/json;charset=utf-8")
    public String thirdFindAdsToIndex(@PathVariable String status);

    /**
     * 根据position和status查找广告列表
     *
     * @param position
     * @param status
     * @return
     */
    @GetMapping(value = "ad/third/findAdsByPositionAndStatus/{position}/{status}", produces = "application/json;charset=utf-8")
    public String thirdFindTop2ByPositionAndStatusOrderByCreatedAt(@PathVariable String position, @PathVariable String status);

    /**
     * 根据状态查找轮播图列表
     *
     * @param status
     * @return
     */
    @GetMapping(value = "banner/third/findBannersByStatus/{status}", produces = "application/json;charset=utf-8")
    public String thirdFindBannersByStatus(@PathVariable String status);

    /**
     * 轮播图列表-条件查询
     *
     * @param searchMap 查询条件封装
     * @param page      页码
     * @param size      页大小
     * @return 分页结果
     */
    @RequestMapping(value = "banner/third/findBannerBySearch/{page}/{size}", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public String thirdFindBannerBySearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size);

    /**
     * 根据ID查询轮播图详情
     *
     * @param id ID
     * @return
     */
    @RequestMapping(value = "banner/third/findBannerById/{id}", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
    public String thirdFindBannerById(@PathVariable String id);

    /**
     * 增加轮播图
     *
     * @param ad
     */
    @RequestMapping(value = "banner/third/addBannerByBanner", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public void thirdAddBannerByBanner(@RequestBody String ad);

    /**
     * 修改轮播图
     *
     * @param ad
     */
    @RequestMapping(value = "banner/third/updateBannerByBanner", method = RequestMethod.PUT, produces = "application/json;charset=utf-8")
    public void thirdUpdateBannerByBanner(@RequestBody String ad);
}
